package tech.aistar.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import tech.aistar.entity.Phone;
import tech.aistar.service.IPhoneService;

import java.util.List;

/**
 * Created by 幻想乡 on 2019/12/30.
 */
@Controller

public class  list {

    @Autowired
    private IPhoneService phoneService;

    @GetMapping("/list")
    public String list(Model model) {


        List<Phone> phones = phoneService.findAll();


        //将得到的图书的集合放入到request作用域中去
        model.addAttribute("phones",phones);
        return ("list/list");
    }
}